<template>
	<view class="page">
		
		<view class="content"  :style="{bottom:taBheight+'rpx'}">
			<view class="item" v-for="(item,index) in list" @click="goLink(item)">
				<image :src="item.goImg" mode="" class="img" v-if="link==item.link"></image>
				<image :src="item.image" mode="" class="img" v-else></image>
				<view class="name" :style="link==item.link?'color:#1AA261':''">{{item.name}}</view>
				<!-- <view class="badge" v-if="item.link=='/pages/physical/physical'&&!data.physical_status"></view> -->
		
			</view>
		</view>
	</view>
	
</template>

<script>
	export default {
		name:"tabbar",
		props:['link'],
		data() {
			return {
				taBheight:0,
				list:[
					{
						image:'../../static/image/home.png',
						goImg:'../../static/image/goHome.png',
						name:'首页',
						link:'/pages/index/index'
					},{
						image:'../../static/image/order.png',
						goImg:'../../static/image/goOrder.png',
						name:'订单',
						link:'/pages/order/order'
					},{
						image:'../../static/image/news.png',
						goImg:'../../static/image/goNews.png',
						name:'消息',
						link:'/pages/notice/notice'
					},{
						image:'../../static/image/comprehensive.png',
						goImg:'../../static/image/goComprehensive.png',
						name:'综合服务',
						link:'/pages/service/service'
					},{
						image:'../../static/image/mine.png',
						goImg:'../../static/image/goMine.png',
						name:'我的',
						link:'/pages/mine/mine'
					},
				]
			};
		},
		created() {
			
			// this.getHeight()
			
			
		},
		methods: {
			goLink(item){
				if(!item.link){
					uni.showToast({
						title: '开发中...',
						duration: 2000,
						icon:'none'
					});
					return
				}
				if(this.link==item.link){
					return
				}
				if(item.link=='/pages/adoptionCenter/adoptionCenter'){
					
					uni.navigateTo({
						url:item.link
					})
				}else{
					uni.reLaunch({
						url:item.link
					});
				}
			},
			getHeight() {
				const res = uni.getSystemInfoSync()
				const { screenHeight, safeArea: { bottom } } = res
				console.log(res)
				if (screenHeight && bottom){
					let safeBottom = screenHeight - bottom
					// this.safeBottom=safeBottom
					this.taBheight=safeBottom 
				}
			}
		}
	}
</script>

<style lang="scss" scoped>
.content{
	width: 750rpx;
	height: 146rpx;
	background: rgba(255,255,255,0.85);
	border-radius: 83rpx 83rpx 0 0 ;
	box-shadow: 0rpx -4rpx 24rpx 0rpx rgba(148,148,148,0.19);
	backdrop-filter: blur(10px);
	position: fixed;
	// bottom: 33rpx;
	left: 50%;
	transform: translateX(-50%);
	z-index: 999;
	
	display: flex;
	// justify-content: space-around;
	flex-wrap: nowrap;
	padding: 20rpx 50rpx;
	.item{
		width: 20%;
		// height: 100%;
		// display: flex;
		// align-items: center;
		// justify-content: center;
		position: relative;
		.img{
			width: 44rpx;
			height:44rpx;
			margin-left: 50%;
			transform: translateX(-50%);
		}
		.name{
			font-size: 20rpx;
			font-family: PingFangSC, PingFang SC;
			font-weight: 400;
			color: #999999;
			line-height: 20rpx;
			text-align: center;
			margin-top:10rpx;
		}
	}
}
</style>